<!--
 * @Author: HeAo
 * @Date: 2022-08-24 15:14:53
 * @LastEditTime: 2022-08-24 19:15:38
 * @LastEditors: HeAo
 * @Description: 
 * @FilePath: \JavaScripe\day-13事件机制\05-阻止默认事件发生.html
 * 别乱动！
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <form action="01-事件的初体验.html">
    <input type="text" name="" id="text">
    <!--默认自动提交到01-中，改变submit自动提交-->
    <input type="submit" value="提交" id="sub">
  </form>

</body>
<script>
  var text = document.getElementById('text')
  var sub = document.getElementById('sub')
  sub.onclick = function (event) {
    event.preventDefault();
    console.log('我是改变的submit');
  }
</script>

</html>